<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/WEB-INF/yy-1_0.tld" prefix="yy"%>


<%
	boolean bPageFirst = false;
	boolean bPagePrev = false;
	boolean bPageNext = false;
	boolean bPageLast = false;
	
	
	if( 1 == iPageNo && iPageCount == 1 ){
			bPageFirst = false;
			bPagePrev = false;
			bPageNext = false;
			bPageLast = false;
	}
	else if( 1 == iPageNo && iPageCount > iPageNo ){
			bPageFirst = false;
			bPagePrev = false;
			bPageNext = true;
			bPageLast = true;
	}
	else if( 1 < iPageNo && iPageCount > iPageNo ){
			bPageFirst = true;
			bPagePrev = true;
			bPageNext = true;
			bPageLast = true;
	}
	else  if( 1 < iPageNo && iPageCount <= iPageNo ){
			bPageFirst = true;
			bPagePrev = true;
			bPageNext = false;
			bPageLast = false;
	}

	String strPageSize10 = "";
	String strPageSize15 = "";
	String strPageSize20 = "";

	if( iPageSize==10 ){
		strPageSize10 = " selected ";
	}
	else if( iPageSize==15 ){
		strPageSize15 = " selected ";
	}
	else if( iPageSize==20 ){
		strPageSize20 = " selected ";
	}
	else{
		strPageSize10 = " selected ";
	}

%>
<script type="" language="javascript">


	function refresh(){
		document.all.item("pageNo").value=1;
		document.testForm.submit();
	}
	
	function first(){
		document.all.item("pageNo").value = 1;
		document.testForm.submit();
	}

	function prev(){
		var strpageNo = String(document.all.item("pageNo").value );
		var iPageNo = parseInt( strpageNo );
		document.all.item("pageNo").value = iPageNo - 1;
//		alert(document.all.item("pageNo").value);
		document.testForm.submit();
	}

	function next(){
		var strpageNo = String(document.all.item("pageNo").value );
		var iPageNo = parseInt( strpageNo );
		document.all.item("pageNo").value = iPageNo + 1;
//		alert(document.all.item("pageNo").value);
		document.testForm.submit();
	}

	function last(){
		document.all.item("pageNo").value = document.all.item("pageCount").value;
		document.testForm.submit();
	}

	function go( iPageNo ){
		document.all.item("pageNo").value = iPageNo;
		document.testForm.submit();
	}

	function checkAll(form){
		var selectedRecords = form.selectedRecords;
		for (var i=0;i<selectedRecords.length;i++){
			selectedRecords[i].checked = form.chkall.checked;
/*			var e = form.elements[i];
			if (e.name != 'chkall'){
				e.checked = form.chkall.checked;
			}
*/
		}
	}

</script>


<TABLE height="20px" width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<TR align=middle>
<%
	if( bPageFirst ){
%>
		<TD bgColor=#e4e4e4>
			<A href="javascript: first();"><IMG alt="首页" src="image/page_first.gif" align=absMiddle border=0></A>
		 </TD>
		<TD bgColor=#e4e4e4>
			<A href="javascript: prev();"><IMG alt="上一页" src="image/page_previous.gif" align=absMiddle border=0></A>
		</TD>
<%		
	}
	else{
%>
		<TD bgColor=#e4e4e4>
			<IMG alt="首页" src="image/page_first.gif" align=absMiddle border=0 > 
		</TD>
		<TD bgColor=#e4e4e4>
			<IMG alt="上一页" src="image/page_previous.gif" align=absMiddle border=0 > 
		</TD>
<%		
	}
%>

<%
		String strpageNoTdBgColor = "";
		int iPageCountIndex = 0;
        for( iPageCountIndex=1; iPageCountIndex<=iPageCount; iPageCountIndex++ ){
			if( iPageCountIndex == iPageNo ){
%>
		<TD bgColor=#5d7790>&nbsp;<FONT class=curpage><B><%=iPageCountIndex%></B></FONT>&nbsp;</TD>
<%
			}
			else if(iPageCountIndex > iPageNo-8 && iPageCountIndex < iPageNo+8){
%>
		<TD bgColor=#e4e4e4>&nbsp;<A class=page href="javascript: go( <%=iPageCountIndex%> )"><B><%=iPageCountIndex%></B></A>&nbsp;</TD>
<%
			}
        }
%>


<%
	if( bPageLast ){
%>
		<TD bgColor=#e4e4e4>
			<A href="javascript: next();"><IMG alt="下一页" src="image/page_next.gif" align=absMiddle border=0></A>
		 </TD>
		<TD bgColor=#e4e4e4>
			<A href="javascript: last();"><IMG alt="尾页" src="image/page_last.gif" align=absMiddle border=0></A>
		</TD>
<%		
	}
	else{
%>
		<TD bgColor=#e4e4e4>
			<IMG alt="下一页" src="image/page_next.gif" align=absMiddle border=0 > 
		</TD>
		<TD bgColor=#e4e4e4>
			<IMG alt="尾页" src="image/page_last.gif" align=absMiddle border=0 > 
		</TD>
<%		
	}
%>

		<TD bgColor="transparent" nowrap class="page">&nbsp;&nbsp;</TD>
		<TD bgColor=#e4e4e4 nowrap class="page">&nbsp;<B>共<%=iMaxCount%>条</B>&nbsp;</TD>
		<TD bgColor="transparent" nowrap class="page">&nbsp;&nbsp;</TD>
		<TD bgColor="transparent" nowrap class="page">
			<SELECT ID="pageSize" NAME="pageSize" class="page">
				<OPTION VALUE="10" <%=strPageSize10%>>每页10条</OPTION>
				<OPTION VALUE="15" <%=strPageSize15%>>每页15条</OPTION>
				<OPTION VALUE="20" <%=strPageSize20%>>每页20条</OPTION>
			</SELECT>
		</TD>
		<TD bgColor="#e4e4e4" nowrap class="page">&nbsp;&nbsp;<INPUT TYPE="button" VALUE="刷新" class="refreshButton" onclick="refresh();"></TD>

	  <TD width="100%"></TD>
   </TR>
</TABLE>

